import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import importPlugin from 'eslint-plugin-import'

export default [
  { files: ['**/*.{js,mjs,cjs,ts}'] },
  {
    extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
    languageOptions: {
      globals: { ...globals.browser, ...globals.node },
      parserOptions: { ecmaVersion: 2021, sourceType: 'module' }
    },
    plugins: { import: importPlugin },
    rules: {
      'import/extensions': ['error', 'ignorePackages', { js: 'never', jsx: 'never', ts: 'never', tsx: 'never' }],
      'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
      'import/no-unresolved': 'off',
      'no-console': 'off',
      'no-unused-vars': 'off'
    },
    settings: { 'import/resolver': { node: { extensions: ['.js', '.ts'] } } }
  },
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended
]
